package com.xyht.sca_s.student_manage_system.modules.welcomeNewStudent.controller;


import com.xyht.sca_s.student_manage_system.common.commonReturn.ResponseResult;
import com.xyht.sca_s.student_manage_system.common.desEncodeAndDecode.annotation.SecretBody;
import com.xyht.sca_s.student_manage_system.modules.welcomeNewStudent.entity.req.SmsWnsChargePlanReq;
import com.xyht.sca_s.student_manage_system.modules.welcomeNewStudent.entity.req.SmsWnsIdListReq;
import com.xyht.sca_s.student_manage_system.modules.welcomeNewStudent.service.SmsWnsChargePlanService;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * <p>
 * 收费计划表 前端控制器
 * </p>
 *
 * @author XYHT
 * @since 2024-01-15
 */
@RestController
@SecretBody
@RequestMapping("/welcomeNewStudent/chargePlan")
public class SmsWnsChargePlanController {
    @Resource
    private SmsWnsChargePlanService smsWnsChargePlanService;

    @ApiOperation("添加收费计划")
    @PostMapping("/add")
    public ResponseResult addPlan(@RequestBody SmsWnsChargePlanReq planReq) {
        return smsWnsChargePlanService.addPlan(planReq);
    }

    @ApiOperation("删除收费计划")
    @PostMapping("/del")
    public ResponseResult delPlan(@RequestBody SmsWnsIdListReq idListReq) {
        return smsWnsChargePlanService.delPlan(idListReq);
    }

    @ApiOperation("修改收费计划")
    @PostMapping("/update")
    public ResponseResult updatePlan(@RequestBody SmsWnsChargePlanReq planReq) {
        return smsWnsChargePlanService.updatePlan(planReq);
    }

    @ApiOperation("发布计划")
    @PostMapping("/publish")
    public ResponseResult publishPlan(@RequestBody SmsWnsChargePlanReq planReq) {
        return smsWnsChargePlanService.publishPlan(planReq);
    }

    @ApiOperation("收费计划列表")
    @GetMapping("/list")
    public ResponseResult listPlan(@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
                                   @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize,
                                   @RequestParam("type") Integer type,
                                   @RequestParam(value = "searchStr", required = false) String searchStr) {
        return smsWnsChargePlanService.listPlan(pageNum, pageSize, type, searchStr);
    }

    @ApiOperation("收费计划详情")
    @GetMapping("/detail")
    public ResponseResult planDetail(@RequestParam("id") String id) {
        return smsWnsChargePlanService.planDetail(id);
    }

    @ApiOperation("通过学号获取学生id")
    @PostMapping("/getStuIdByStuIdCard")
    public ResponseResult getStuIdByStuIdCard(@RequestBody SmsWnsIdListReq idListReq) {
        return smsWnsChargePlanService.getStuIdByStuIdCard(idListReq);
    }

    @ApiOperation("展示所有年级")
    @GetMapping("/getAllGrades")
    public ResponseResult getAllGrades() {
        return smsWnsChargePlanService.getAllGrades();
    }

    @ApiOperation("暂停计划")
    @PostMapping("/pausePlan")
    public ResponseResult pausePlan(@RequestBody SmsWnsChargePlanReq planReq) {
        return smsWnsChargePlanService.pausePlan(planReq);
    }

    @ApiOperation("向计划中添加人")
    @PostMapping("/addStudent")
    public ResponseResult addStudent(@RequestBody SmsWnsChargePlanReq planReq) {
        return smsWnsChargePlanService.addStudent(planReq);
    }

    @ApiOperation("通过userIdList获取stuIdList")
    @PostMapping("/getStuIdListByUserIdList")
    public ResponseResult getStuIdListByUserIdList(@RequestBody SmsWnsIdListReq idListReq) {
        return smsWnsChargePlanService.getStuIdListByUserIdList(idListReq);
    }

    @ApiOperation("通过stuIdList获取userIdList")
    @PostMapping("/getUserIdListByStuIdList")
    public ResponseResult getUserIdListByStuIdList(@RequestBody SmsWnsIdListReq idListReq) {
        return smsWnsChargePlanService.getUserIdListByStuIdList(idListReq);
    }

}

